import java.util.Comparator;
import java.util.PriorityQueue;


class student{

}

class inCamp implements Comparator<Integer> {
    @Override
    public int compare(Integer o1, Integer o2) {
        return o2.compareTo(o1);
    }
}



public class PriQuee {

    public static void main(String[] args) {
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>(new inCamp());
        priorityQueue.offer(33);
        priorityQueue.offer(22);
//        priorityQueue.offer(new student());



     }


    public static int[] smallestK(int[] arr, int k) {
        PriorityQueue<Integer> p = new PriorityQueue<>();
        for (int i = 0; i < arr.length; i++) {
            p.offer(arr[i]);
        }
        int[] t = new int[k];
        for (int i = 0; i < k; i++) {
            t[i] = p.poll();
        }
        return t;

    }
    public static int[] smallestK1(int[] arr, int k) {
        PriorityQueue<Integer> p = new PriorityQueue<>(new inCamp());
        for (int i = 0; i < k; i++) {
            p.offer(arr[i]);
        }
        for (int i = k; i < arr.length; i++) {
            int val = p.peek();
            if (val > arr[i]) {
                p.poll();
                p.offer(arr[i]);
            }
        }

        int[] ret = new int[k];
        for (int i = 0; i < k; i++) {
            ret[i] = p.poll();
        }
        return ret;

    }
}
